# import sys
# import urllib
# import json

# reload(sys)
# sys.setdefaultencoding('utf-8')
# type = sys.getfilesystemencoding()
# r = urllib.urlopen("http://172.21.212.7:8060/modelser/json/5affd6beffc23108c4dc738c")
# a = r.read().decode('utf-8').encode(type)
# print a
# jsData = json.loads(a.decode('raw_unicode_escape'))

# js = json.loads('{"insun": "泰囧 / 人在囧途2 / Lost in Thailand "}')

# print js


# import time
# from __init__ import OGMSService_DEBUG

# success = []
# error = []
# count = 0
# server = OGMSService_DEBUG.CreateServer('172.21.212.7', 8060)
# server.connect()
# try:
#     if server.connect() : 
#         access = server.getServiceAccess()
#         for num in range(0, 52):
#             list_ms = access.getModelServicesList(num*100, 100)
#             for index, item in enumerate(list_ms):
#                 print 'Service ID: [' + item.id + '] Name [' + item.name + '] start to test!'
#                 count = count + 1
#                 time.sleep(5)
#                 if item.testify() == 1:
#                     print 'Service ID: [' + item.id + '] Name [' + item.name + '] test successfully!'
#                     success.append(item.id)
#                 else:
#                     print 'Service ID: [' + item.id + '] Name [' + item.name + '] test fail!'
#                     error.append(item.id)
# except Exception, e:
#     print e.message

# logfile = open("E:\\DemoData\\GeoModeling\\YTXTestResult.json", "w")
# logfile.write("Count : " + str(count) + "\n")
# logfile.write("Success : " + str(success) + "\n")
# logfile.write("error : " + str(error) + "\n")

# logfile.close()

from __init__ import OGMSService_DEBUG

server = OGMSService_DEBUG.CreateServer("127.0.0.1", 8060)
access = server.createServiceAccess()